/**
 * @author Mike
 * @date 2017/04/27
 */

import React from 'react';
import { render } from 'react-dom';
import { Provider } from 'react-redux';
import { Router,hashHistory } from 'react-router';
import { syncHistoryWithStore } from 'react-router-redux';

import createStore from './store/configureStore'; //引入store配置
import reducer from './reducers';  // 引入reducers集合
import routes from './routes';   // 引入路由配置

import './assets/scss/main';  // 引入样式文件1
import './assets/scss/common';  // 引入样式文件2

const store = createStore(reducer);

// 创建一个增强版的history来结合store同步导航事件
const history = syncHistoryWithStore(hashHistory, store);

render(
  //Provider向子类种传递store
  <Provider store={store}>
    <Router history={history} routes={routes} />
  </Provider>,
  document.getElementById('app')
);